Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use `version ##` without breaking consistency with commands that changed

    I have an ado (ritest) that takes other commands as an argument. It was written in Stata 13, so I use "version 13". But, if people use it with commands that changed since version 13 (eg, Tobit) it produces different output.

    For example

    Code:
    tobit ...
    ritest ... : tobit ...
    produces two different outputs of tobit on newer Stata versions, because the command changed since Stata 13 and my ado file specifies "version 13" before executing the command. Specifying "version 17" would make my ado file unusable on older versions of Stata.

    Is there a way in which I can specify version ## : command inside my ado file that executes a single line of code with whatever version of the interpreter the user is currently using?

  • #2
    Hi Simon!
    Ok I think there are two options for that.
    1) Drop version statement. This could make a few things unstable.
    2) include a flexible version statement?
    something like
    if `c(stata_version)'<13 {
    display in red "You need Stata 13 or newer to use the command".
    }

    3) in addition to 2, perhaps add version on the pieces of code that would other wise break if used in newer Stata versions?
    HTH
    Fernando

    Comment

    Working...
    X